<%--
  Created by IntelliJ IDEA.
  User: 86151
  Date: 2022/1/8
  Time: 22:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>员工编辑页面</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
    <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>
    <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
</head>
<body>
    <h1 style="text-align: center">城市编辑页面</h1>
<%--    <form action="/city/update" method="post" class="form-horizontal" >--%>
        <input type="hidden" value="${edit.cityid}" name="id">
        <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">城市编号</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" id="inputEmail3" value="${edit.cityid}" name="cityid">
            </div>
        </div>
        <div class="form-group">
            <label for="inputPassword3" class="col-sm-2 control-label">城市名</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" id="inputPassword3" value="${edit.cityname}" name="cityname">
            </div>
        </div>
        <div class="form-group">
            <label for="inputPassword3" class="col-sm-2 control-label">人口数</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" id="inputPassword4" value="${edit.citysize}" name="citysize">
            </div>
        </div>
        <select class="form-control" style="width: 83%;margin-left: auto" name="cid">
            <c:forEach items="${country}" var="countrys">
                <option value="${countrys.cid}" <c:if test="${countrys.cid == edit.cid}">selected</c:if>>${countrys.cname}</option>
            </c:forEach>
        </select>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="text" class="btn btn-default">提交</button>
            </div>
        </div>
<%--    </form>--%>

</body>
</html>
<script>
$('button').on('click',function () {
    console.log($('input').attr('neme','cityid').val())
    $.ajax({
        method:'post',
        url:'/city/update',
        data:{
            cityid:$('input').eq(1).val(),
            cityname:$('input').eq(2).val(),
            citysize:$('input').eq(3).val(),
            cid:$('select').attr('neme','cid').val()
        }
    })
})
</script>